<?php
require_once(OC_App::getAppPath('jobposition') . "/lib/position.php");

$LoginStats = PUtil::checkUserLogin(true);
if ($LoginStats !== true) {
   echo $LoginStats;
   exit();
}

OCP\JSON::callCheck();

$job_id = JRequest::getInt("job_id", 0);
$pos_id = JRequest::getInt("pos_id", 0);
$sources = JRequest::getString("sources", '');
$sources = $sources ? explode(',', $sources) : array();

$model = new PJobpositionModelPosition();

$pos_detail = $model->getPosDetail($job_id, $pos_id, $sources);

if (!$pos_detail) {
   OC_JSON::error(array('data' => array( 'message' => $model->getError() ? $model->getError() : '网络异常，请重试！')));
   exit;
}

OC_JSON::success(array('data' => $pos_detail));
